/*
 ============================================================================
 Name		: ButtonControl.h
 Author	  : William Zhang
 Version	 : 1.0
 Copyright   : all rights reserved.
 Description : CButtonControl declaration
 ============================================================================
 */

#ifndef BUTTONCONTROL_H
#define BUTTONCONTROL_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <coecntrl.h>

// CLASS DECLARATION

/**
 *  CButtonControl
 * 
 */
class CButtonControl : public CCoeControl
	{
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CButtonControl();

	/**
	 * Two-phased constructor.
	 */
	static CButtonControl* NewL(const TRect& aRect,const CCoeControl* aParent);

	/**
	 * Two-phased constructor.
	 */
	static CButtonControl* NewLC(const TRect& aRect,const CCoeControl* aParent);
	
public:
	void SetButtonIcon(const CFbsBitmap* aIcon,const CFbsBitmap* aIconMask);
	
private:
	/**
	 * Constructor for performing 1st stage construction
	 */
	CButtonControl();

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL(const TRect& aRect,const CCoeControl* aParent);

private:	
	//from CCoeControl
	void SizeChanged();
	
	void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	
	void Draw(const TRect& aRect) const;

private:
	enum ButtonState{
		ENone,
		EButtonClicked,
		EButtonPressing
	};
	
private:
	enum ButtonState iState;
	
	CFbsBitmap* iButtonIcon;
	CFbsBitmap* iButtonIconMask;
	
	TBuf<20> iTips;
	};

#endif // BUTTONCONTROL_H
